<?php
/**
 * gpa_new Description
 * @package
 * @name model_admin
 * @filesource model_admin.php
 * @author Meta Sanjaya
 */

class model_admin extends Model
{
    /**
     * @access public
     * @method __construct
     * @param void
     * @return void
     */
    public function  __construct()
    {
        parent::__construct();
    }

    public function getSettings()
    {
        return $this->db->query("SELECT * FROM #_settings")->rows;
    }

    public function getApps()
    {
        return glob(__APP__ . '*', GLOB_ONLYDIR);
    }

    public function isAdmin($username)
    {
        $model_user = $this->getModel('user');
        $user = $model_user->getUserBy('username', $username);
        $group = $model_user->getGroupBy('group_name', 'administrators');

        if($model_user->isActive($username) && ($user['group_id'] == $group['group_id'])) {
            return true;
        }

        return false;
    }
}
?>